package im.xz.cn.xiacore.pvpModel;

import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;

public class awa implements CommandExecutor {
    @Override
    public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s, @NotNull String[] strings) {
        Player player = (Player) commandSender;
        String name = player.getName();
        try {
            if (player.getDisplayName().contains("免战")) {
                player.setDisplayName(name);
                player.sendMessage(ChatColor.RED + "你已关闭免战状态！");
            }else {
                player.setDisplayName("免战 " + name);
                player.sendMessage(ChatColor.GREEN + "你已开启免战状态。你下线重进会回复为默认状态。");
            }
        }catch (NullPointerException ignore) {

        }

        return false;
    }
}